<style scoped>
  @import "/assets/umeditor/themes/default/_css/umeditor.css";
</style>
<style>
  .edui-container{
    margin-left: 25px;
    width: calc(100% - 30px)!important;
  }
</style>
<template>
  <div :id="id" type="text/plain" style="width:95%;margin-left: 5%"></div>
</template>

<script>
export default {
  data() {
    return {
      id: parseInt(Math.random()*1000000)+ 'ueditorId',
      ue:{}
    }
  },
  components: {
  },

  props: ['htmls'],
  watch:{
    htmls:function(){
      let vm = this
      vm.ue.setContent(vm.htmls)
    }
  },
  mounted () {
    let vm = this
    vm.ue = UM.getEditor(vm.id)
    vm.ue.ready(function() {
      vm.ue.setContent(vm.htmls)
    });
  },
  methods: {
    getAllHtml () {
      return this.ue.getContent()
    }
  }
}
</script>
